package com.zty.prince.tuangou.activity;

import android.content.Intent;
import android.os.Handler;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.zty.prince.tuangou.R;
import com.zty.prince.tuangou.utils.SPUtil;

public class SplashActivity extends AppCompatActivity {

    Handler mHandler = new Handler();

    public static final String IF_FITST_START = "isfirst";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        /*overridePendingTransition(android.support.v7.appcompat.R.anim.abc_fade_in,
                android.support.v7.appcompat.R.anim.abc_fade_out);*/

        mHandler.postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent intent;
                if (SPUtil.getFirstBoolean(SplashActivity.this,IF_FITST_START,true)){
                    intent = new Intent(SplashActivity.this,GuideUIActivity.class);
                }else {
                    intent = new Intent(SplashActivity.this,MainActivity.class);
                }
                startActivity(intent);

                finish();

                overridePendingTransition(android.support.v7.appcompat.R.anim.abc_fade_in,
                        android.support.v7.appcompat.R.anim.abc_fade_out);

            }
        }, 3000);

    }
}
